package top.oool.actuator;

import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by IntelliJ IDEA.
 * User: kui.zhang
 * Date: 2019/4/25 9:37
 * Email:kui.zhang@chinaredstar.com
 */
@Configuration
@EnableConfigurationProperties({SystemInfoProperties.class})
public class SystemInfoEndpointConfiguration {

    private final SystemInfoProperties systemInfoProperties;

    public SystemInfoEndpointConfiguration(SystemInfoProperties systemInfoProperties) {
        this.systemInfoProperties = systemInfoProperties;
    }

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnEnabledEndpoint
    public SystemInfoEndpoint systemInfoEndpoint() {
        return new SystemInfoEndpoint(systemInfoProperties);
    }

}
